package executer;


import java.util.Vector;
import java.util.concurrent.*;

/**
 * TODO
 *
 * @author 司松坡
 * @createTime 2023年05月05日
 */
public class Executer {


    static  Integer i = 100;
    static ExecutorService executorService =  new ThreadPoolExecutor(10, 100, 600, TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(65536));

    public void test() {
        while (true) {
            executorService.execute(() -> {
                synchronized (this) {
                    while (i>0){
                        System.out.println("111:" + i);
                        i = i-1;
                    }
                }
                executorService.shutdown();
            });
            executorService.execute(() -> {
                synchronized (this) {
                    while (i>0){
                        System.out.println("222:" + i);
                        i = i-1;
                    }
                }
                executorService.shutdown();
            });
            executorService.execute(() -> {
                synchronized (this) {
                    while (i>0){
                        System.out.println("333:" + i);
                        i = i-1;
                    }
                }
                executorService.shutdown();
            });
        }
    }
}
